using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_allticketsMap : EntityTypeConfiguration<so_alltickets>
    {
        public so_allticketsMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FORM_OF_PAYMENT, t.Pended, t.Refunded });

            // Properties
            this.Property(t => t.Ticket__)
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.passenger_name)
                .IsFixedLength()
                .HasMaxLength(33);

            this.Property(t => t.Invoice_Nb)
                .HasMaxLength(8);

            this.Property(t => t.Customer)
                .HasMaxLength(110);

            this.Property(t => t.Customer__)
                .HasMaxLength(6);

            this.Property(t => t.FORM_OF_PAYMENT)
                .IsRequired()
                .HasMaxLength(14);

            this.Property(t => t.AIRLINE_CODE)
                .IsFixedLength()
                .HasMaxLength(2);

            this.Property(t => t.AIRLINE_NUMBER)
                .IsFixedLength()
                .HasMaxLength(3);

            this.Property(t => t.ROUTING)
                .HasMaxLength(50);

            this.Property(t => t.COMMISSION_RATE)
                .IsFixedLength()
                .HasMaxLength(4);

            this.Property(t => t.AGENT)
                .IsFixedLength()
                .HasMaxLength(2);

            this.Property(t => t.PNR_REF)
                .IsFixedLength()
                .HasMaxLength(6);

            this.Property(t => t.NUMBER_OF_TICKET_BOOKS)
                .IsFixedLength()
                .HasMaxLength(2);

            this.Property(t => t.TAX_1)
                .IsFixedLength()
                .HasMaxLength(8);

            this.Property(t => t.TAX_2)
                .IsFixedLength()
                .HasMaxLength(8);

            this.Property(t => t.TAX_3)
                .IsFixedLength()
                .HasMaxLength(8);

            this.Property(t => t.Pended)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.Refunded)
                .IsRequired()
                .HasMaxLength(5);

            // Table & Column Mappings
            this.ToTable("so_alltickets");
            this.Property(t => t.Ticket__).HasColumnName("Ticket_#");
            this.Property(t => t.passenger_name).HasColumnName("passenger_name");
            this.Property(t => t.DATE_OF_ISSUE).HasColumnName("DATE_OF_ISSUE");
            this.Property(t => t.Invoice_Nb).HasColumnName("Invoice_Nb");
            this.Property(t => t.Customer).HasColumnName("Customer");
            this.Property(t => t.Customer__).HasColumnName("Customer_#");
            this.Property(t => t.FORM_OF_PAYMENT).HasColumnName("FORM_OF_PAYMENT");
            this.Property(t => t.AIRLINE_CODE).HasColumnName("AIRLINE_CODE");
            this.Property(t => t.AIRLINE_NUMBER).HasColumnName("AIRLINE_NUMBER");
            this.Property(t => t.ROUTING).HasColumnName("ROUTING");
            this.Property(t => t.sale_amount).HasColumnName("sale_amount");
            this.Property(t => t.Cash_Collection).HasColumnName("Cash_Collection");
            this.Property(t => t.Tax_Amount).HasColumnName("Tax_Amount");
            this.Property(t => t.COMMISSION_RATE).HasColumnName("COMMISSION_RATE");
            this.Property(t => t.purchase_amount).HasColumnName("purchase_amount");
            this.Property(t => t.Profit_Loss).HasColumnName("Profit/Loss");
            this.Property(t => t.AGENT).HasColumnName("AGENT");
            this.Property(t => t.PNR_REF).HasColumnName("PNR_REF");
            this.Property(t => t.Client_Discount).HasColumnName("Client_Discount");
            this.Property(t => t.NUMBER_OF_TICKET_BOOKS).HasColumnName("NUMBER_OF_TICKET_BOOKS");
            this.Property(t => t.TAX_1).HasColumnName("TAX_1");
            this.Property(t => t.TAX_2).HasColumnName("TAX_2");
            this.Property(t => t.TAX_3).HasColumnName("TAX_3");
            this.Property(t => t.Comm_Rate).HasColumnName("Comm_Rate");
            this.Property(t => t.Pended).HasColumnName("Pended");
            this.Property(t => t.Refunded).HasColumnName("Refunded");
            this.Property(t => t.Document__).HasColumnName("Document_#");
            this.Property(t => t.Return__).HasColumnName("Return_#");
        }
    }
}
